CREATE OR REPLACE PROCEDURE read_lob
IS
  v_lob_loc         BLOB;
  CURSOR profiles_cur IS
    SELECT id, full_name, resume, picture 
      FROM customer_profiles;
  v_profiles_rec    customer_profiles%ROWTYPE;
BEGIN
  OPEN profiles_cur;
  LOOP
    FETCH profiles_cur INTO v_profiles_rec;
     v_lob_loc := v_profiles_rec.picture;
     DBMS_OUTPUT.PUT_LINE('The length is: '||  
                          DBMS_LOB.GETLENGTH(v_lob_loc));
     DBMS_OUTPUT.PUT_LINE('The ID is: '|| v_profiles_rec.id);
     DBMS_OUTPUT.PUT_LINE('The blob is read: '||
     UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(v_lob_loc,200,1)));
    EXIT WHEN profiles_cur%NOTFOUND;
  END LOOP;
  CLOSE profiles_cur;
END;
/
